package com.web.settlement.controller;

import com.web.common.BaseResult;
import com.web.common.enums.BaseStatus;
import com.web.settlement.entity.Settlement;
import com.web.settlement.service.SettlementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "API - SettlementController",description = "settlementController")
@RestController
@CrossOrigin
@RequestMapping("/settlement")
public class SettlementController {

    @Autowired
    private SettlementService settlementService;

    @RequestMapping(value = "/addSettlement",method = RequestMethod.GET)
    @ApiOperation(value = "新增Settlement")
    public void addSettlement(){
        settlementService.addSettlement();
    }

    @RequestMapping(value = "/settlementList")
    public BaseResult<List<Settlement>> accumulateList(@ModelAttribute Settlement settlement){
        List<Settlement> list = settlementService.getSettlements(settlement);
    	return new BaseResult<>(BaseStatus.SUCCESS.getCode(),list);
    }
}
